import { ObjCreate } from "../../common/ObjCreate";
import { Language } from "../../../../../extend/language/Language";
import { ToolTipsManager } from "../../../../../com/mui/manager/ToolTipsManager";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../resource/ResFileConst";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { Cache } from "../../../cache/Cache";
import { CursorManager } from "../../../manager/CursorManager";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { EventName } from "../../../mvc/EventName";
//class LockPetMing
    
    export  class LockPetMing /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.addEventListener(flash.events.MouseEvent.CLICK, this.clickHander);
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            this.buttonMode = true;
            this.lockBmp = new Object /* flash.display.Bitmap */();
            this.addChild(this.lockBmp);
            ObjCreate.createTextField(Language.getString(54919), 20, 5, 54, 18, this, null, false, false);
            ToolTipsManager.register(this, null, Language.getString(54923));
            LoaderHelp.addResCallBack(ResFileConst.PetMing, this.onLoadedHandler);
            return;
        }

        /* internal  */onLoadedHandler(): void
        {
            this.lockBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.PetMingLock);
            return;
        }

        /* internal  */clickHander(arg1: Object /* flash.events.Event */): void
        {
            var loc1=Cache.instance.petMing.lockIsSelect;
            Cache.instance.petMing.lockIsSelect = !loc1;
            if (Cache.instance.petMing.lockIsSelect) 
            {
                Cache.instance.petMing.isOneEat = false;
            }
            if (Cache.instance.petMing.lockIsSelect) 
            {
                CursorManager.showCursor(CursorManager.PetMingUnLock);
            }
            else 
            {
                CursorManager.showCursor(CursorManager.NO_CURSOR);
            }
            Dispatcher.dispatchEvent(new Object /* flash.events.Event */(EventName.PetMingLockClick));
            return;
        }

        /* internal */ /* var */lockBmp: Object /* flash.display.Bitmap */;
    }
